Skip to content

Conversation

@joviegas
Copy link
Contributor

@joviegas joviegas commented Dec 3, 2025

Add retries to CrtHttpClientApiCallTimeoutTest for race condition and BatchingEfficiencyUnderLoadTest with sleep to allow batch flush completion

Motivation and Context

Fixes intermittent test failures in CI/CodeBuild environments:

  1. BatchingEfficiencyUnderLoadTest - Tests were asserting before async batch manager completed flushing batches to WireMock
  2. CrtHttpClientApiCallTimeoutTest - Race condition between timeout exception and CRT native callback failure

Modifications

  • Added @RetryableTest(maxRetries = 3) to retry tests on transient failures
  • Added Thread.sleep() in BatchingEfficiencyUnderLoadTest.runThroughputTest() to wait for scheduled batch flushes

License

  • I confirm that this pull request can be released under the Apache 2 license

@joviegas joviegas requested a review from a team as a code owner December 3, 2025 05:23
@Fred1155
Copy link
Contributor

Fred1155 commented Dec 3, 2025

There are two sonarcloud warning on the code, can we address that? I'm not sure why it ask to "remove this use of "Thread.sleep()"

@joviegas joviegas force-pushed the joviegas/flaky_test_retry branch from e038321 to f3a9672 Compare December 3, 2025 20:40
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 3, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@joviegas
Copy link
Contributor Author

joviegas commented Dec 3, 2025

There are two sonarcloud warning on the code, can we address that? I'm not sure why it ask to "remove this use of "Thread.sleep()"

  • Addressed one by removing the usued import from Test
  • Also marked other as false positive since we do need a Sleep for minimum of Batching duration time so that messages are flushed

@joviegas joviegas added this pull request to the merge queue Dec 3, 2025
Merged via the queue into master with commit 2392409 Dec 3, 2025
38 of 40 checks passed
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants